kubectl是用來和k8s叢集溝通的命令行工具,可以用來建立、删除、更新和检查k8s的各種資源。因為接下來的挑戰會用kubectl來進行作業,所以在開始往Kubernetes前進時,我們需要先安裝一下kubectl。
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
➜ ~ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.13-dispatcher", GitCommit:"fd22db44e150011eccc8729db223945384460143", GitTreeState:"clean", BuildDate:"2020-07-24T07:48:37Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"darwin/amd64"}
➜ ~
brew install kubernetes-cli
kubectl version --client
gcloud components install kubectl
在zsh上設定
➜ ~ source <(kubectl completion zsh)
➜ ~ source ~/.zshrc
其它系統Kubectl安裝請參考官網